<?php

	global $wpdb;
	
	$db_name = "fade_slider"; 
	include (TEMPLATEPATH . '/framework/includes/get_'.$db_name.'_db.php');

	$slider_datas = $wpdb->get_results("SELECT * FROM $table_name ORDER BY orderby");
	
?>

<!-- begin banner -->
<div class="banner">

		<!-- begin banner model #1 -->
		<div class="banner_model_1">
			
			<?php if(!$slider_datas){ ?>
				<div class="slider_default picloader">
					<img src="<?php bloginfo('template_url'); ?>/images/default/slider.png" alt=""/>
				</div>
			<?php } else { ?>
			
			<!-- begin slider content -->
			<div class="slider_content">
				
				<!-- begin slider items -->
				<div class="slider_full">
					
					<?php $n=0; foreach ($slider_datas as $data) { ?>
					<!-- begin slider item #1 -->
					<div class="slider_item" <?php if ($n > 0){ echo "style=\"display:none;\""; } ?>>
						
							<?php 
								
								switch($data->skin){
									case "skin1":
										$table_class = "slider_left_image";
									break;
									case "skin2":
										$table_class = "slider_right_image";
									break;
									case "skin3":
										$table_class = "slider_center_image";
									break;	
									case "skin4":
										$table_class = "slider_center_image";
									break;									
								}
							
							
							?>
							<div class="<?php echo $table_class; if ($n == 0){ echo " picloader"; } ?> <?php if($data->border != "on"){ echo "slider_border"; } ?>">
								<?php
									if($data->url){ 
										echo "<a href=\"".$data->url."\" target=\"".$data->target."\">";
									}
								?>
								<?php if($data->ptype == "video") { echo $data->src; } else { ?>
								<img src="<?php echo $data->src; ?>" alt=""/>
								<?php } ?>
								<?php if($data->url){ echo "</a>";	} ?>
							</div>
							
							<?php if ($data->title != "" or $data->description != ""){ ?>
							<div class="slider_text<?php if($data->skin == "skin3"){ echo "_full"; } ?> <?php if($data->border != "on"){ echo "noborder"; } ?>">
								<h2><?php echo $data->title; ?></h2>
								<span class="textspan">
									<?php echo $data->description; ?>
								</span>
								
								<?php if($data->readmore == "on"){ ?>
								<?php 
								if($data->url){ echo "<a href=\"".$data->url."\" target=\"".$data->target."\">";	} ?>	
									<div class="slider_text_more">
										<span><?php echo get_option('fade_slider_read_more', 'Read More'); ?></span>
									</div>		
								<?php if($data->url){ echo "</a>";	} ?>
								<?php } ?>
						
							</div>
							<?php } ?>
							
					</div>
					<!-- end slider item #1 -->
					<?php $n++; } ?>
					
				</div>
				<!-- end slider items -->
			</div>
			<!-- end slider content -->

			<?php if($n > 1){ ?>
			<!-- begin slider buttons -->
			<div class="slider_buttons">
				<ul class="slider_click">
					<?php foreach ($slider_datas as $data) { ?>
					<li></li>
					<?php } ?>
				</ul>
			</div>
			<!-- end slider buttons -->	
			<?php } ?>
			
			<?php } ?>

		
		</div>
		<!-- end banner model #1 -->
		
</div>
<!-- end banner -->